<html>
	<head>
		<title>R Publication</title>
		<link href="R.css" type="text/css" rel="stylesheet"/>
		 <script type="text/javascript" src="jquery-1.2.6.min.js"></script>   
		 <script type="text/javascript" src="R.js"></script>
	</head>
	<body onload="initialize()">
	  <div id="toolbar">
	    <div id="buttonContainer">
	      <button id="expAll" onclick="showAll_click()">Expand All</button>
	      <button id="collAll" onclick="hideAll_click()">Collapse All</button>
	    </div>
	    <div id="logo">
	      <img src="RPubLogo.png"/>
	    </div>
	  </div>
	  <div id="generatedOutput">
		<div class="RComment">
    This document shows some of the simple manipulations that you can do   using time series series objects.  It is meant to be a simple   example of how you can interleave comments with useful code and   produce a literate program from it. <br/><br/>  Load the XTS library (which derives from zoo) and the tseries   library (which we use for dummy data)
</div>

<div class="RCode">
  <div class="RControls">
    <button class="hideBtn">Hide</button>
  </div>
  <div class="RCodeContent">
    library(xts);<br/>library(tseries);<br/>
    </div>
</div>

<div class="RComment">
    Lets warm up with some simple math
</div>

<div class="RCode">
  <div class="RControls">
    <button class="hideBtn">Hide</button>
  </div>
  <div class="RCodeContent">
    a <- 1+1;<br/>b <- 1/2;<br/>pi<br/>  [1] 3.141593<br/>
    </div>
</div>

<div class="RComment">
    Load in some dummy data from YHOO
</div>

<div class="RCode">
  <div class="RControls">
    <button class="hideBtn">Hide</button>
  </div>
  <div class="RCodeContent">
    yhoo <- get.hist.quote("YHOO");<br/>sample.xts <- xts(yhoo,order.by=index(yhoo),descr="my ts object")<br/>  An object of class “xts”
             Open   High    Low  Close
1996-04-12  25.25  43.00  24.50  33.00
1996-04-15  35.75  36.00  30.00  32.25
1996-04-16  32.25  32.25  28.00  28.75
1996-04-17  28.25  28.25  24.75  27.00
1996-04-18  30.12  30.12  28.00  29.25
1996-04-19  30.12  30.75  28.75  28.87
1996-04-22  29.00  29.00  27.50  28.25
1996-04-23  28.75  29.00  28.00  28.00
1996-04-24  28.50  29.12  27.75  29.00
1996-04-25  30.00  32.25  29.00  31.25
1996-04-26  32.00  32.25  31.25  31.75
1996-04-29  31.50  32.00  30.50  31.00
1996-04-30  31.25  31.50  29.50  29.75
1996-05-01  30.25  31.75  30.00  31.62
1996-05-02  31.50  33.25  31.50  32.88
1996-05-03  32.25  32.50  31.25  32.00
1996-05-06  32.50  32.50  29.37  30.12
1996-05-07  30.00  30.75  29.75  30.37
1996-05-08  30.50  30.75  29.12  30.25
1996-05-09  30.00  30.75  29.75  30.75
1996-05-10  30.75  31.75  30.50  31.25
1996-05-13  31.37  31.50  30.00  30.25
1996-05-14  30.75  31.00  29.50  29.50
1996-05-15  30.00  30.75  29.75  30.25
1996-05-16  29.75  30.50  29.75  30.25
1996-05-17  30.25  30.50  29.75  30.00
1996-05-20  30.00  30.37  29.00  29.00
1996-05-21  29.00  29.12  27.75  28.00
1996-05-22  28.00  28.00  27.00  27.50
1996-05-23  27.50  29.50  27.50  29.50
1996-05-24  29.50  30.00  28.75  29.50
1996-05-28  29.25  29.62  28.50  29.00
1996-05-29  28.75  28.75  27.00  27.50
1996-05-30  27.50  29.00  27.50  28.25
1996-05-31  28.75  28.75  27.25  28.00
1996-06-03  27.75  28.00  27.25  27.25
1996-06-04  27.25  28.00  27.12  27.12
1996-06-05  27.50  27.50  27.00  27.12
1996-06-06  28.50  28.75  27.50  27.75
1996-06-07  27.25  27.25  26.50  26.87
1996-06-10  26.87  26.87  26.12  26.50
1996-06-11  26.12  26.50  25.50  25.50
1996-06-12  25.75  26.75  25.75  26.00
1996-06-13  25.75  26.25  24.50  25.50
1996-06-14  24.75  25.50  24.75  24.75
1996-06-17  24.75  25.00  22.50  23.00
1996-06-18  21.75  22.25  20.50  20.50
1996-06-19  21.00  21.50  20.50  20.75
1996-06-20  21.00  21.75  20.50  21.75
1996-06-21  22.25  22.75  21.75  22.25
1996-06-24  22.25  22.25  21.75  21.75
1996-06-25  21.75  22.25  21.50  21.75
1996-06-26  21.50  22.00  20.75  21.00
1996-06-27  21.25  22.00  18.25  18.25
1996-06-28  19.50  21.00  19.00  21.00
1996-07-01  20.50  22.25  20.50  21.75
1996-07-02  22.25  22.25  21.25  21.25
1996-07-03  21.75  21.75  20.50  21.00
1996-07-05  20.00  20.62  19.75  20.00
1996-07-08  20.00  20.00  19.25  20.00
1996-07-09  19.50  20.00  18.50  18.50
1996-07-10  18.75  18.75  16.00  16.37
1996-07-11  16.00  17.25  15.50  17.25
1996-07-12  17.00  18.00  17.00  17.50
1996-07-15  18.00  18.50  17.50  17.87
1996-07-16  17.75  18.50  17.37  18.00
1996-07-17  18.12  19.25  17.75  19.25
1996-07-18  19.50  19.87  18.75  19.25
1996-07-19  19.87  19.87  18.75  18.87
1996-07-22  19.00  19.00  17.50  18.00
1996-07-23  17.50  18.00  16.25  16.25
1996-07-24  16.25  16.37  15.50  15.75
1996-07-25  15.75  16.75  15.75  16.25
1996-07-26  16.25  16.62  15.75  16.62
1996-07-29  16.25  16.62  16.12  16.12
1996-07-30  16.25  17.50  16.25  17.00
1996-07-31  17.00  18.00  17.00  18.00
1996-08-01  18.00  19.00  17.50  19.00
1996-08-02  18.50  19.25  18.50  18.87
1996-08-05  19.00  19.37  18.87  18.87
1996-08-06  19.25  19.25  18.12  18.12
1996-08-07  17.87  18.25  17.75  18.00
1996-08-08  18.00  18.50  17.75  18.50
1996-08-09  17.37  17.75  16.50  17.75
1996-08-12  17.50  17.50  17.00  17.25
1996-08-13  17.00  20.50  17.00  19.87
1996-08-14  20.12  20.62  20.00  20.37
1996-08-15  20.37  20.37  19.62  19.87
1996-08-16  19.50  19.87  19.12  19.37
1996-08-19  19.37  19.62  19.37  19.62
1996-08-20  19.62  19.62  19.12  19.12
1996-08-21  19.12  19.25  18.25  18.62
1996-08-22  18.62  20.00  18.25  19.87
1996-08-23  19.75  20.25  19.75  19.75
1996-08-26  20.12  20.12  19.75  19.75
1996-08-27  19.75  20.37  19.75  20.12
1996-08-28  20.12  22.12  20.12  21.12
1996-08-29  20.87  21.12  19.75  19.75
1996-08-30  19.87  20.12  19.37  19.62
1996-09-03  19.00  19.37  18.75  19.00
1996-09-04  19.00  19.25  18.62  18.87
1996-09-05  18.37  18.62  18.37  18.37
1996-09-06  18.25  18.62  18.12  18.37
1996-09-09  18.12  18.87  18.12  18.75
1996-09-10  18.75  19.12  18.50  18.50
1996-09-11  18.75  19.00  18.50  18.87
1996-09-12  18.75  19.50  18.75  19.50
1996-09-13  19.87  20.87  19.75  20.62
1996-09-16  20.62  21.00  20.50  20.62
1996-09-17  21.12  21.62  20.75  21.62
1996-09-18  21.50  21.62  20.37  20.75
1996-09-19  20.75  21.50  20.50  21.50
1996-09-20  21.50  24.00  21.37  24.00
1996-09-23  23.87  24.62  23.75  23.81
1996-09-24  23.75  23.87  22.50  22.75
1996-09-25  22.50  22.62  21.62  21.87
1996-09-26  21.62  22.12  21.62  21.87
1996-09-27  21.87  22.12  21.50  21.75
1996-09-30  21.75  21.75  21.25  21.25
1996-10-01  21.00  21.25  19.12  19.62
1996-10-02  20.37  22.62  20.37  21.75
1996-10-03  22.12  23.50  22.00  22.62
1996-10-04  23.12  23.25  22.00  22.00
1996-10-07  22.00  22.62  22.00  22.25
1996-10-08  22.37  22.62  20.87  20.87
1996-10-09  20.87  22.50  20.87  22.50
1996-10-10  22.75  22.87  20.37  20.50
1996-10-11  20.37  20.87  20.37  20.62
1996-10-14  20.87  21.62  20.62  21.62
1996-10-15  21.50  21.75  21.00  21.50
1996-10-16  21.37  21.62  21.00  21.12
1996-10-17  21.12  22.12  21.12  22.00
1996-10-18  22.25  22.25  21.75  22.00
1996-10-21  21.75  22.25  21.75  21.87
1996-10-22  21.87  22.12  21.25  21.25
1996-10-23  21.25  21.50  21.00  21.12
1996-10-24  21.00  21.12  20.87  20.87
1996-10-25  20.87  21.00  20.50  20.50
1996-10-28  20.50  20.75  20.50  20.62
1996-10-29  20.62  20.75  20.50  20.50
1996-10-30  20.50  20.62  20.12  20.12
1996-10-31  20.00  20.25  19.50  19.75
1996-11-01  19.50  19.75  19.50  19.50
1996-11-04  19.50  19.75  19.00  19.00
1996-11-05  19.00  19.25  17.62  18.25
1996-11-06  18.00  18.50  17.87  18.00
1996-11-07  17.87  18.37  17.87  18.12
1996-11-08  18.12  19.50  18.12  19.50
1996-11-11  19.50  20.25  19.50  20.12
1996-11-12  19.87  20.12  19.62  19.75
1996-11-13  19.75  19.75  18.62  19.00
1996-11-14  19.00  19.00  18.12  18.19
1996-11-15  18.37  18.62  18.25  18.50
1996-11-18  18.25  18.50  17.87  18.12
1996-11-19  18.12  18.12  17.75  17.87
1996-11-20  17.87  18.12  17.62  17.75
1996-11-21  17.62  17.75  17.25  17.37
1996-11-22  17.50  17.62  17.25  17.62
1996-11-25  17.62  19.25  17.37  19.12
1996-11-26  19.25  19.75  18.87  18.87
1996-11-27  19.00  19.00  18.50  18.56
1996-11-29  18.50  19.12  18.50  19.12
1996-12-02  18.75  19.12  18.75  19.00
1996-12-03  18.75  20.62  18.75  20.00
1996-12-04  19.87  20.37  19.75  19.75
1996-12-05  19.75  22.12  19.75  21.31
1996-12-06  20.25  21.75  19.87  20.50
1996-12-09  20.37  21.37  20.25  21.25
1996-12-10  21.25  21.37  20.25  20.25
1996-12-11  19.87  19.87  19.12  19.37
1996-12-12  19.50  20.12  19.00  20.00
1996-12-13  19.50  20.25  19.50  19.87
1996-12-16  20.00  20.25  18.62  18.75
1996-12-17  18.62  18.75  17.87  18.12
1996-12-18  18.00  19.37  17.87  18.37
1996-12-19  18.50  18.62  17.87  18.00
1996-12-20  18.12  18.12  17.00  17.00
1996-12-23  17.50  18.50  17.37  17.94
1996-12-24  18.12  18.12  17.75  18.12
1996-12-26  18.00  18.25  17.87  17.87
1996-12-27  18.25  18.75  17.87  18.25
1996-12-30  18.25  18.25  17.75  18.00
1996-12-31  17.50  17.62  16.75  17.00
1997-01-02  17.00  17.50  16.75  17.50
1997-01-03  17.62  18.75  17.52  18.37
1997-01-06  19.12  19.87  19.00  19.87
1997-01-07  19.87  20.50  19.44  20.12
1997-01-08  20.19  20.37  18.75  18.87
1997-01-09  18.87  19.75  18.87  19.37
1997-01-10  19.00  19.25  19.00  19.25
1997-01-13  19.87  22.12  19.75  21.75
1997-01-14  21.87  21.87  20.87  20.87
1997-01-15  23.00  26.00  22.87  25.37
1997-01-16  25.37  27.00  24.75  26.12
1997-01-17  26.00  26.87  24.87  26.62
1997-01-20  26.50  31.25  26.50  29.50
1997-01-21  28.87  32.25  28.62  31.87
1997-01-22  31.62  33.25  31.00  31.87
1997-01-23  32.13  35.25  32.13  35.25
1997-01-24  34.63  35.00  32.00  33.13
1997-01-27  33.13  37.38  33.13  36.44
1997-01-28  36.63  36.63  31.62  32.63
1997-01-29  32.63  33.75  31.87  33.63
1997-01-30  33.00  35.38  32.50  34.13
1997-01-31  34.50  35.13  33.75  33.88
1997-02-03  33.88  35.00  33.50  34.88
1997-02-04  34.63  36.25  34.00  34.63
1997-02-05  34.38  35.00  33.13  33.88
1997-02-06
<br/>
    </div>
</div>

<div class="RComment">
    Plot the resulting time series
</div>

<div class="RCode">
  <div class="RControls">
    <button class="hideBtn">Hide</button>
  </div>
  <div class="RCodeContent">
    plot(sample.xts)<br/><img class="rGraphic" src="25538.jpg"/>
    </div>
</div>


	  </div>
	</body>

</html>
